package mall.dao.handler.column;

import java.util.HashMap;
import java.util.Map;

import org.apache.commons.dbutils.BasicRowProcessor;
import org.apache.commons.dbutils.BeanProcessor;
import org.apache.commons.dbutils.RowProcessor;

/**
 * 对带下划线的列名, 进行变态处理, 让它可以映射到Bean的不带下划线的对应属性
 * @author Administrator
 *
 */
public class UNDERLINE {
	private static Map<String, String> columnToPropertyNameOverrides = new HashMap<String, String>();
	static {
		columnToPropertyNameOverrides.put("create_time", "createTime");
		columnToPropertyNameOverrides.put("total_amount", "totalAmount");
		columnToPropertyNameOverrides.put("user_name", "userName");
		columnToPropertyNameOverrides.put("sell_point", "sellPoint");
		columnToPropertyNameOverrides.put("last_modified_time", "lastModifiedTime");
		columnToPropertyNameOverrides.put("on_sale", "onSale");
		columnToPropertyNameOverrides.put("on_sale_time", "onSaleTime");
		columnToPropertyNameOverrides.put("is_parent", "parent");
		columnToPropertyNameOverrides.put("parent_id", "parentId");
	}
	
	public static RowProcessor PROCESSOR = new BasicRowProcessor(new BeanProcessor(columnToPropertyNameOverrides));
}
